<?php echo Modules::run('content/header_content') ?> 
<style type="text/css">
      .form-signin {
        max-width: 400px;
        padding: 19px 29px 29px;
        margin: 50px auto;
        background-color: #fff;
        border: 1px solid #e5e5e5;
        -webkit-border-radius: 5px;
           -moz-border-radius: 5px;
                border-radius: 5px;
        -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.05);
           -moz-box-shadow: 0 1px 2px rgba(0,0,0,.05);
                box-shadow: 0 1px 2px rgba(0,0,0,.05);
	    background:#EFEFEF;
      }
      .form-signin .form-signin-heading,
      .form-signin .checkbox {
        margin-bottom: 10px;
      }
      .form-signin input[type="text"],
      .form-signin input[type="password"] {
        height: auto;
        padding: 7px 9px;
      }
      hr{
		margin: 15px 0;
		border: 0;
		border-top: 1px solid #EEE;
		border-bottom: 1px solid #FFF;
		}

</style>
		<div class="form-signin">
		<?php
		$login = array(
			'name'	=> 'login',
			'id'	=> 'login',
			'value' => set_value('login'),
			'maxlength'	=> 80,
			'size'	=> 30,
			'class' => 'input-block-level',
			'placeholder' => 'Username or Email address'
		);
		if ($login_by_username AND $login_by_email) {
			$login_label = 'Email or login';
		} else if ($login_by_username) {
			$login_label = 'Login';
		} else {
			$login_label = 'Email';
		}
		$password = array(
			'name'	=> 'password',
			'id'	=> 'password',
			'size'	=> 30,
			'class' => 'input-block-level',
			'placeholder' => 'Password',
		);
		$remember = array(
			'name'	=> 'remember',
			'id'	=> 'remember',
			'value'	=> 1,
			'checked'	=> set_value('remember'),
			'style' => 'margin:0;padding:0',
		);
		$captcha = array(
			'name'	=> 'captcha',
			'id'	=> 'captcha',
			'maxlength'	=> 8,
		);
		?>
		
    <?php //echo validation_errors(); ?>
		
		<?php echo form_open($this->uri->uri_string(), 'name="form" id="login-form"'); ?>
        
			<h2 class="form-signin-heading">Please sign in</h2>
			<?php echo form_input($login); ?>
			<span style="color:#E91510"><?php echo form_error($login['name']); ?><?php echo isset($errors[$login['name']])?$errors[$login['name']]:''; ?></span>
			<hr>
			
			<?php echo form_password($password); ?>
			<span style="color:#E91510"><?php echo form_error($password['name']); ?><?php echo isset($errors[$password['name']])?$errors[$password['name']]:''; ?></span>
			
			<hr>
			<p>
			<label for="remember"><?php echo form_checkbox($remember); ?> Remember me</label>
			</p>
			
			<?php echo form_submit('submit', 'Sign in','class="btn btn-primary" type="submit"'); ?>
			
			<span style="float:right"> 
        <a href="<?php echo base_url('auth/forgot_password'); ?>"> Forgot password ? </a>
			</span>
			
		<?php echo form_close(); ?>
		</div>
      </div>

      <div id="push"></div>
    </div>
    
    <script src="<?php echo base_url();?>assets/js/jquery.validate.js"></script>
    
    <script type="text/javascript">
		$("#login-form").validate({
                rules: {
                    login: "required",                    
                    password: "required",  
                },
                messages: {
                    name: "Username or Email is required!",
                    password: "Password is required",
                },
                submitHandler: function(form) {					
                    form.submit();
                    //alert('ok');
                }
            });
            
            <?php if (isset($errors[$login['name']])){ ?>
				$("#login").removeClass('valid');
				$("#login").addClass('error');
			<?php }?>
            
            <?php if (isset($errors[$password['name']])){ ?>
				$("#password").removeClass('valid');
				$("#password").addClass('error');				
			<?php }?>
	</script>

<?php echo Modules::run('content/footer_content') ?>